	#include "TextManager.h"

TextManager::TextManager() {
}
TextManager::~TextManager() {
}

void TextManager::Initialize(sf::RenderWindow* window, Gui* gui) {
	m_renderWindow = window;
	m_gui = gui;
	theTexture = new sf::Texture;
	friendlyTexture = new sf::Texture;
	theTexture->loadFromFile("Assets/Images/pluspoints.png");
	friendlyTexture->loadFromFile("Assets/Images/minuspoints.png");

}
void TextManager::addKillScore(sf::RenderWindow* m_renderWindow) {
	//MutantScore mutantScoreObj;
	killScoreObj = new KillScore;
	killScoreObj->Initialize(m_renderWindow, m_gui ,theTexture);
	m_arrayOfKillScore.push_back(killScoreObj);

}	

void TextManager::addFriendlyScore(sf::RenderWindow* m_renderWindow) {
	//MutantScore mutantScoreObj;
	friendlyScoreObj = new FriendlyScore;
	friendlyScoreObj->Initialize(m_renderWindow, m_gui ,friendlyTexture);
	m_arrayOfFriendlyScore.push_back(friendlyScoreObj);

}

void TextManager::Update() {
		for(int i = 0; i < m_arrayOfKillScore.size(); i++) {
			m_arrayOfKillScore[i]->Update();
		}
		for(int i = 0; i < m_arrayOfFriendlyScore.size(); i++) {
			m_arrayOfFriendlyScore[i]->Update();
		}
	
		for(int i = 0; i < m_arrayOfKillScore.size(); i++) {
			if (m_arrayOfKillScore[i]->atScore == true) {
				m_arrayOfKillScore[i]->Cleanup();
				delete m_arrayOfKillScore[i];
				m_arrayOfKillScore.erase(m_arrayOfKillScore.begin() + i);
			}
		}

		for(int i = 0; i < m_arrayOfFriendlyScore.size(); i++) {
			if (m_arrayOfFriendlyScore[i]->atScore == true) {
				m_arrayOfFriendlyScore[i]->Cleanup();
				delete m_arrayOfFriendlyScore[i];
				m_arrayOfFriendlyScore.erase(m_arrayOfFriendlyScore.begin() + i);
			}
		}


		/*
		for(int i = 0; i < m_arrayOfBossScore.size(); i++) {
			m_arrayOfBossScore[i]->Update();
		}
		for(int i = 0; i < m_arrayOfRaiderScore.size(); i++) {
			m_arrayOfRaiderScore[i]->Update();
		}
		for(int i = 0; i < m_arrayOfTriplekill.size(); i++) {
			m_arrayOfTriplekill[i]->Update();
		}
		for(int i = 0; i < m_arrayOfMultikill.size(); i++) {
			m_arrayOfMultikill[i]->Update();
		}
		for(int i = 0; i < m_arrayOfMonsterkill.size(); i++) {
			m_arrayOfMonsterkill[i]->Update();
		}
		*/
}

void TextManager::Cleanup() {
	delete killScoreObj;
	delete theTexture;
	delete friendlyTexture;
}
